﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1,user-scalable=no,maximum-scale=1,initial-scale=1" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="UTF-8">
    <title>{$item[title]}</title>
  
    <link type="text/css" rel="stylesheet" href="{$file}/css/style.css" />
<link rel="stylesheet" href="{$file}/css/sweetalert.css" />
<script type="text/javascript" src="{$file}/js/sweetalert-dev.js"></script>
    <script src="{$file}/js/jquery-1.4.2.min.js"></script>
</head>
<body  style="background: url('{$file}/images/bgpic.jpg') no-repeat; background-size: 100% 100%;color:;">
   <script src='http://api.map.baidu.com/api?v=2.0&ak=5PESLgvMcSbSUbPjmDKgvGZ3'></script>
 <script type="text/javascript">
    function distance(){
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                var position = {
                     lng: r.point.lng,
                     lat: r.point.lat,
                }
                positions(position);
            }else {
                alert('获取当前位置失败,请确定您开启了定位服务');
            }
        },{enableHighAccuracy: true});
    }
    function positions(position){
  //  	alert(position.lng);
   // 	alert(position.lat);
   $("#lat").val(position.lat);
   $("#lng").val(position.lng);
    	
    	var url="";
    	var obj="lat="+position.lat+"&lng="+position.lng;

    	//保存到cookie
    			$.post(url, obj, function (data) {
			 var data = eval('('+data+')');
		
		});
     
    }
  
    {if empty($_COOKIE['gps'])}
	var gps=0;
	var cookgps="{$gps}";
	var lo="{$actdetail[locationtype]}";
	var place="{$actdetail[city]}"
	if(cookgps==''){
		if(lo==1||place!=''){
    	var p=place.split(",");
			  var geolocation = new BMap.Geolocation();
			  geolocation.getCurrentPosition(function(r) {
			      var _this = this;
			      if (this.getStatus() == BMAP_STATUS_SUCCESS) {
			          var mk = new BMap.Marker(r.point);
			          locLng = r.point.lng;
			          locLat = r.point.lat;
			         
			          var geoc = new BMap.Geocoder();
			          geoc.getLocation(r.point, function(rs){
			              var addComp = rs.addressComponents;
			              var position =  addComp.province + addComp.city +  addComp.district +  addComp.street +  addComp.streetNumber;
			        
			              if(p.indexOf(addComp.province)>=0||p.indexOf(addComp.city)>=0||p.indexOf(addComp.district)>=0){
			            	//alert(addComp.province);
			            	 gps=1;
			             }else{
			            	 //swal("对不起",'您不在本次活动范围,请期待我们下一次活动', "info");
			            	 gps=0;
			             };
			             var url="";
			         	var obj="gps="+gps;

			         	//保存到cookie
			         			$.post(url, obj, function (data) {
			     			 var data = eval('('+data+')');
			     		
			     		});	
			             
			          });
			      }
			  }, {
			      enableHighAccuracy: true
			  });
	}else{
		gps=0;
	}
	}else{
		gps=cookgps;
	}
    {/if}
    
    </script> 
 <style>
 .gz{
 		background:#E26636;border-radius:7px;
        display:inline-block;text-align:center;margin:0 auto;
        width:120px;height:50px;font-size:20px;line-height:40px; text-decoration:none;
 }
 </style>
<style>
.fe-floatback {width: 32px; position: fixed; top: 4px;left:4px; text-align: center; z-index: 1003;}
.fe-floatback a{ display: block; width: 32px; height: 32px;}
.fe-floatback a img{width:32px;height:32px;opacity:0.5;}
{$item['diycss']}
</style>
<div class="fe-floatback">
		<a href="{$backurl}">
			<img src="../core/resource/images/goback.png"></i>
		</a>
</div>
{if !empty($actdetail[apic])}
<div id="aniamteBox">
		<img src="{php echo tomedia($actdetail[apic]);}" alt="" />
	</div>  
	{/if}
    <div class="main">
        <p id="title">{$actdetail[title]}</p>
        <div class="whiteFont">
{php echo htmlspecialchars_decode($actdetail[adept])}
        </div>
        <div class="whiteFont hide" style="text-align:center;margin-top:20px;" id="gz">
        <a href="{$actdetail[sucai]}" class="gz" style="color:{$actdetail[color]}; ">点我关注</a>
        </div>
{if 0==0}
        <div id="index">
            <div id="box">
                <div class="row">
                    <div class="card">
                        <div class="photo" style="background: url('{$file}/images/red/redpic.png') no-repeat;background-size: 100% 100%;"><p id="vmoney1"></p></div>
                        <div class="photo-box" style="background: url('{$file}/images/red/red.gif') no-repeat;background-size: 100% 100%;"></div>
                    </div>
                    <div class="card">
                     <div class="photo" style="background: url('{$file}/images/red/redpic.png') no-repeat;background-size: 100% 100%;"><p id="vmoney2"></p></div>
                         <div class="photo-box" style="background: url('{$file}/images/red/red.gif') no-repeat;background-size: 100% 100%;"></div>
                    </div>
                    <div class="card">
                       <div class="photo" style="background: url('{$file}/images/red/redpic.png') no-repeat;background-size: 100% 100%;"><p id="vmoney3"></p></div>
                         <div class="photo-box" style="background: url('{$file}/images/red/red.gif') no-repeat;background-size: 100% 100%;"></div>
                    </div>
                </div>
                <div class="row">
                    <div class="card">
                        <div class="photo" style="background: url('{$file}/images/red/redpic.png') no-repeat;background-size: 100% 100%;"><p id="vmoney4"></p></div>
                         <div class="photo-box" style="background: url('{$file}/images/red/red.gif')no-repeat;background-size: 100% 100%;"></div>
                    </div>
                    <div class="card">
                   <div class="photo" style="background: url('{$file}/images/red/redpic.png') no-repeat;background-size: 100% 100%;"><p id="vmoney5"></p></div>
                          <div class="photo-box" style="background: url('{$file}/images/red/red.gif') no-repeat;background-size: 100% 100%;"></div>
                    </div>
                    <div class="card">
                        <div class="photo" style="background: url('{$file}/images/red/redpic.png') no-repeat;background-size: 100% 100%;"><p id="vmoney6"></p></div>
                          <div class="photo-box" style="background: url('{$file}/images/red/red.gif') no-repeat;background-size: 100% 100%;"></div>
                    </div>
                </div>
            </div>
        </div>
{elseif $flag==1}
		<div class="smallFont smallFont2">
		<img src="{$file}/images/end.png" width="100%" />
		</div>


{elseif $flag==2}
		<div class="smallFont smallFont2">
		<img src="{$file}/images/start.png" width="100%" />
		</div>

{/if}

        <div id="footer">
            <div id="logo"><img src="{$file}/images/v_24.png" alt=""/></div>
        </div>
		<div class="smallFont smallFont2" style="color:#fff">
			<p>提现说明：</p>
			因微信官方规定，提现金额需在1-200元,注意：提现金额不要超过200！
			<p style="text-align:right" id="countp">活动已参加：{$playerNums}人</p>
			<p style="text-align:right">我还剩：<span style="color:#c9222e;font-weight:bold" id="chance">{$leftPlayCount}</span></p>
			<p style="text-align:right">奖池：可提现<span style="color:#c9222e;font-weight:bold" id="countm1" value="{}">{if $money<=0}0.00{else}{$money}{/if}</span>元</p>
				<div class="fixed-wrap fixed-b">  
				<a class="btn01 sp2"  href="{$awardurl}">获奖名单</a>
				<a class="btn01 sp2" id="cash" onclick="cash1()" style="float:right">提现</a>
				</div>
		</div>
			<script type="text/javascript">
	/*	function cash1(){
			
					var openid='{$user[openid]}';
					$("#cash").attr("data","0"); 
					var cashed='{$countM}';
					var myDate = new Date();
					h=myDate.getHours();
				
					var cashstime='{$actdetail[cashstime]}';
					var cashetime='{$actdetail[cashetime]}';
					
					if(cashstime!=null||cashetime!=null){
						
						if(h<cashstime||h>=cashetime){
							
							swal("不在提现时间内","我们的提现时间为"+cashstime+":00~"+cashetime+":00", "info");
							return false;
						}	
					}
					
					swal({  
						title: "红包提现", 
						text: "您的可提现金额是"+cashed+"元",
						type: "info",   
						showCancelButton: true,
						closeOnConfirm: false, 
						showLoaderOnConfirm: true,
						confirmButtonText: "提现", 
 				 		cancelButtonText: "取消",
						}, function(){  
							setTimeout(function(){ 
								 $.ajax({
						                type: "post",
						                url: "../api.php?this=custom&token="+token+"&plugin=jy_h5game&action=chouhb&rid="+id+"&op=tixian",
						                dataType: "json",
						                data:{openid:openid},
						                success: function (data) {
											if(data.message.success == 0){
													
												swal("提现失败","请联系管理员", "error");
												}else if(data.message.success == 1){
												$("#countm1").html("0.00");
												swal("提现成功","提现"+data.money+"元成功，请实时查看您的微信到账通知", "success");
											}else if(data.message.success == 2){
												
												swal("提现失败","提现金额低于微信规定最小金额", "error");
											}
											else{
												
												swal("提现失败","系统忙，请稍后重新提现", "error");
											}
						                }
						            });
								}, 1000);
							});
			
			}*/
			var money =  $("#countm1").html();
			function cash1(){
			
			
			swal({  
						title: "红包提现", 
						text: "您的可提现金额是"+money+"元",
						type: "info",   
						showCancelButton: true,
						closeOnConfirm: false, 
						showLoaderOnConfirm: true,
						confirmButtonText: "提现", 
 				 		cancelButtonText: "取消",
						}, function(){  
							setTimeout(function(){ 
								 $.ajax({
						                type: "post",
						                url: "../api.php?this=custom&token="+token+"&plugin=jy_h5game&action=chouhb&rid="+id+"&op=tixian",
						                dataType: "json",
						                data:{},
						                success: function (data) {
										//alert(data);
											if(data.message.success == 0){
													
												swal("提现失败","请联系管理员", "error");
												}else if(data.message.success == 1){
												$("#countm1").html("0.00");
												swal("提现成功","提现"+data.message.money+"元成功，请实时查看您的微信到账通知", "success");
											}else if(data.message.success == 2){
												
												swal("提现失败","提现金额低于微信规定最小金额", "error");
											}
											else{
												
												swal("提现失败","系统忙，请稍后重新提现", "error");
											}
						                }
						            });
								}, 1000);
							});
			
			
			
			}
			</script>	
            <style>
            .fixed-b {
			    bottom: 0;
			}
			.fixed-t, .fixed-b {
			    z-index: 800;
			    position: fixed;
			    left: 0;
			    right: 0;
			}
			.fixed-wrap {
			    background: rgba(0,0,0,.7);
			}
            
			.btn01.sp2 {
			    margin: 0.4em 0 0.4em 3.3%;
			}
			.btn01:visited {
			    color: #ffffff;
			}
			.btn01 {
			    display: block;
			    width: 30%;
			    height: 1.5em;
			    line-height: 1.5;
			    background: #f41f3d;
			    border-bottom: 4px solid #c9222e;
			    -webkit-border-radius: 5px;
			    -moz-border-radius: 5px;
			    border-radius: 8px;
			    font-size: 1.3rem;
			    color: #ffffff;
			    text-align: center;
			    float:left;
			    text-decoration:none;
			}
            </style>
		<!--  <div class="smallFont smallFont2">
		<table class="table" cellspacing="0" cellpadding="0">
		<tr><th>序号</th><th>图片</th><th>名称</th><th>数量</th></tr>
		{loop $rulelist $item}
		{php $i++}
		<tr>
		<td class="fontrule">{$i}</td>
		<td><img alt="{$item[rname]}" src="{php echo tomedia($item[rpic])}" width="40%"></td>
		<td>{$item[rname]}</td>
		<td>{$item[count]}</td>
		</tr>
		
		{/loop}
		</table>
		
		</div>-->
		
    </div>
    <input id="lat" type="hidden" value="{$_COOKIE[lat]}">
    <input id="lng" type="hidden" value="{$_COOKIE[lng]}">
    <div id="sureBox" class="hide">
        <div id="sureInBox">
            <div id="head"><i id="del">x</i></div>
            <p>恭喜您中了<span id="money"></span>元</p>
            <div id="btn">
                <input id="ok" type="button" value="全部翻开" />
                <input id="no" type="button" value="再来一波" />
                <div style="clear: both;"></div>
            </div>
        </div>
    </div>
    <div style="height:60px;"></div>
    <input id="openid" type="hidden" value="{$_SESSION['openid']}"/>
</body>
<script>
         var id = '{php echo $e}';
         var token = '{php echo $token}';
         var leftPlayCount = '{php echo $leftPlayCount}';
        var welcomeurl = '{php echo $welcomeurl}';
        var ajaxurl = "../api.php?this=custom&token="+token+"&plugin=jy_h5game&action=chouhb&rid="+id;
    $(function(){
    	var openid=$("#openid").val();
		$("#chance").html(leftPlayCount+'次机会');
    	{if !empty($actdetail[apic])}
		$('#aniamteBox').css({
			width: $(window).width(),
			height: $(window).height()
		});
		$('#aniamteBox').delay(3000).animate({
			top: '-'+$(window).height()+'px'
		},1000);
		{/if}
        $('body').css({minHeight:$(window).height()});
        $('.photo-box').bind('click',function(){
		//alert(leftPlayCount);
 				var obj = $(this);
    			$.ajax({
    				type:'post',
    				url:ajaxurl,
    				dataType:"JSON",
    				data:{openid:openid},
    				success:function(data){
    					var data = eval('('+data+')');
						//没抽中红包
						var money1 = '{php echo $award[0]["fee"]}';
						money1=money1?money1:'0.00'
						var money2 = '{php echo $award[1]["fee"]}';
						money2=money2?money2:'0.00'
						var money3 = '{php echo $award[2]["fee"]}';
						money3=money3?money3:'0.00'
						var money4 = '{php echo $award[3]["fee"]}';
						money4=money4?money4:'0.00'
						var money5 = '{php echo $award[4]["fee"]}';
						money5=money5?money5:'0.00'
						var money6 = '{php echo $award[5]["fee"]}';
						money6=money6?money6:'0.00'
						if(data.message.code == 1){
						        $("#vmoney1").text(money1+'元');
						        $("#vmoney2").text(money2+'元');
								$("#vmoney3").text(money3+'元');
								$("#vmoney4").text(money4+'元');
								$("#vmoney5").text(money5+'元');
								$("#vmoney6").text(money6+'元');
    							obj.prev('.photo').find('p').text('谢谢参与');
    							obj.css({
    								transform:'rotateY(90deg)',
    								webkitTransform:'rotateY(90deg)'
    							})
    							setTimeout(function(){
    								$('.photo-box').css({
    					                transform:'rotateY(90deg)',
    					                webkitTransform:'rotateY(90deg)'
    					            })
    							},1000)
    								setTimeout(function(){
    								$('.photo-box').css({
    					                transform:'rotateY(0deg)',
    					                webkitTransform:'rotateY(0deg)'
    					            })
    							},3000)
    							$("#chance").html(data.message.leftPlayCount+'次机会');
						}//中了
						else if(data.message.code == 0){
						        $("#vmoney1").text(money1+'元');
						        $("#vmoney2").text(money2+'元');
								$("#vmoney3").text(money3+'元');
								$("#vmoney4").text(money4+'元');
								$("#vmoney5").text(money5+'元');
								$("#vmoney6").text(money6+'元');
    							obj.prev('.photo').find('p').text(data.message.fee+'元');
    							$("#money").text(data.message.fee);
    							obj.css({
    								transform:'rotateY(90deg)',
    								webkitTransform:'rotateY(90deg)'
    							})
								setTimeout(function(){
									$('#sureBox').fadeIn();
    							},100)
    							//返回次数和总
    							$("#chance").html(data.message.leftPlayCount+'次机会');
    							$("#countm1").html(data.message.money);
    							$("#countl").html(data['countl']);
								$.ajax({
									url : "../api.php?this=custom&token="+token+"&plugin=jy_h5game&action=chouhb&rid="+id+"&fee="+data.message.fee+"&op=sendhb",				
									datatype : 'json',
									type : 'post',
									success : function(data){
										var re = JSON.parse(data);
										//console.log(re);
										//alert(JSON.stringify(re.message));
										if(re.message.res.result_code == 'FAIL'){
											alert('红包发送失败，请联系管理员！');
										}else if(re.message.res.result_code == 'SUCCESS'){
											alert('红包发送成功，请在公众号查收！');
										}else{
											alert('领取余额红包成功，请在会员中心查看');
										}
									}
								});
						}else if(data.message.code == 10998){	
    							swal(data.message.errorMsg, "error");
    							//location.reload();
    					}else{
						        $("#vmoney1").text(money1+'元');
						        $("#vmoney2").text(money2+'元');
								$("#vmoney3").text(money3+'元');
								$("#vmoney4").text(money4+'元');
								$("#vmoney5").text(money5+'元');
								$("#vmoney6").text(money6+'元');
    							obj.prev('.photo').find('p').text('谢谢参与');
    							obj.css({
    								transform:'rotateY(90deg)',
    								webkitTransform:'rotateY(90deg)'
    							})
    							setTimeout(function(){
    								$('.photo-box').css({
    					                transform:'rotateY(90deg)',
    					                webkitTransform:'rotateY(90deg)'
    					            })
    							},1000)
    								setTimeout(function(){
    								$('.photo-box').css({
    					                transform:'rotateY(0deg)',
    					                webkitTransform:'rotateY(0deg)'
    					            })
    							},3000)
    							$("#chance").html(data.message.leftPlayCount+'次机会');
							
						}
    					//data['type'] =-11;
					/*	alert(data['type']);
    					if(data['type'] == -4){
    						swal({
    							title: "关注我们",
    							text: "点击关注我们参加活动",
    							showCancelButton: true,
    							confirmButtonColor: "#DD6B55",   
    							confirmButtonText: "关注", 
    					 		cancelButtonText: "取消", 
    							closeOnConfirm: false,  
    							closeOnCancel: false },
    							function(isConfirm){ 
    								if (isConfirm) { 
    									window.location.href="{$actdetail[sucai]}"; 
    								} else {
    									swal.close();
    								} 
    							});
    					}else if(data['type'] == -2){
    						swal("提现失败","抱歉，系统未开放", "error");
    						}else if(data['type'] == -1){	

    						swal("你的游戏"+data['unit']+"已经用光","喊朋友来玩可以获得额外的"+data['unit']+"哦", "info");
    						}else if(data['type'] == -3){
    							
    							swal("系统太忙，歇口气再玩吧",data['error'], "error");
    						//	location.reload();
    						}else if(data['type'] == -5){
    							
    						/*	$("#vmoney1").text((data['vmoney'][0]*0.01).toFixed(2)+'元');
    							$("#vmoney2").text((data['vmoney'][1]*0.01).toFixed(2)+'元');
    							$("#vmoney3").text((data['vmoney'][2]*0.01).toFixed(2)+'元');
    							$("#vmoney4").text((data['vmoney'][3]*0.01).toFixed(2)+'元');
    							$("#vmoney5").text((data['vmoney'][4]*0.01).toFixed(2)+'元');
    							$("#vmoney6").text((data['vmoney'][5]*0.01).toFixed(2)+'元');
								
								$("#vmoney1").text((100*0.01).toFixed(2)+'元');
    							$("#vmoney2").text((200*0.01).toFixed(2)+'元');
    							$("#vmoney3").text((300*0.01).toFixed(2)+'元');
    							$("#vmoney4").text((400*0.01).toFixed(2)+'元');
    							$("#vmoney5").text((500*0.01).toFixed(2)+'元');
    					     	$("#vmoney6").text((600*0.01).toFixed(2)+'元');
    							obj.prev('.photo').find('p').text('谢谢参与');
    							obj.css({
    								transform:'rotateY(90deg)',
    								webkitTransform:'rotateY(90deg)'
    							})
    							setTimeout(function(){
    								$('.photo-box').css({
    					                transform:'rotateY(90deg)',
    					                webkitTransform:'rotateY(90deg)'
    					            })
    							},1000)
    								setTimeout(function(){
    								$('.photo-box').css({
    					                transform:'rotateY(0deg)',
    					                webkitTransform:'rotateY(0deg)'
    					            })
    							},3000)
    							$("#chance").html(data['chance']);
    						}else if(data['type'] == -6){
    							swal("对不起",'您不在本次活动范围,请期待我们下一次活动', "info");
    						}else if(data['type'] == -7){
    							swal("抢太快了","歇20秒再后试试吧", "error");
    						}else{
    							$("#vmoney1").text((data['vmoney'][0]*0.01).toFixed(2)+'元');
    							$("#vmoney2").text((data['vmoney'][1]*0.01).toFixed(2)+'元');
    							$("#vmoney3").text((data['vmoney'][2]*0.01).toFixed(2)+'元');
    							$("#vmoney4").text((data['vmoney'][3]*0.01).toFixed(2)+'元');
    							$("#vmoney5").text((data['vmoney'][4]*0.01).toFixed(2)+'元');
    							$("#vmoney6").text((data['vmoney'][5]*0.01).toFixed(2)+'元');
    							obj.prev('.photo').find('p').text(data['rule']['money']+'元');
    							$("#money").text(data['rule']['money']);
    							obj.css({
    								transform:'rotateY(90deg)',
    								webkitTransform:'rotateY(90deg)'
    							})
    						setTimeout(function(){
    							$('#sureBox').fadeIn();
    							},100)
    							//返回次数和总
    							$("#chance").html(data['chance']);
    							$("#countm1").html(data['countm']);
    							$("#countl").html(data['countl']);
    						}
							*/
    				}
    			})
        })
        $('#no,#del').bind('click',function(){
			$('.photo-box').css({
                transform:'rotateY(0deg)',
                webkitTransform:'rotateY(0deg)'
            })
            $('#sureBox').fadeOut();

        })
        $('#ok').bind('click',function(){
            $('#sureBox').fadeOut();
         	setTimeout(function(){
				$('.photo-box').css({
	                transform:'rotateY(90deg)',
	               webkitTransform:'rotateY(90deg)'
	           })
			},1000)
			         			setTimeout(function(){
				$('.photo-box').css({
	                transform:'rotateY(0deg)',
	               webkitTransform:'rotateY(0deg)'
	           })
			},5000)
        })
        $('#formdel').bind('click',function(){
            $('#form').fadeOut();
            $('#address').remove();
            $('.photo-box').css({
                transform:'rotateY(0deg)',
                webkitTransform:'rotateY(0deg)'
            })
            $(window).unbind('touchmove');
        })
    })

</script>
<script>
/*
wx.ready(function () {
    sharedata = {
    	title : "{$actdetail[share_title]}",
   		link :  "{$sharelink}",
   		desc : "{$actdetail[share_content]}",
    	imgUrl:"{php echo tomedia($actdetail[share_icon])}",
      success: function(){
    	// ajax返回加机会
      },
      cancel: function(){
    	//  alert(2);
      }
    };
    wx.onMenuShareAppMessage(sharedata);
    wx.onMenuShareTimeline(sharedata);
    wx.onMenuShareQQ(sharedata);
    wx.onMenuShareWeibo(sharedata);
  });
  */
</script>

<script src="{$file}/js/jweixin-1.0.0.js"></script>
</html>